<?php
declare (strict_types = 1);
/**
 * 频道管理
 */
namespace app\common\model;

class ChannelInfo extends BaseModel
{
    /**
     * 获取列表
     * @param array $where
     * @param int $offset
     * @param int $pagesize
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function channelList($where = [], $offset = 0, $pagesize = 20){
        $list = self::where($where)->limit($offset, $pagesize)->order(['create_time' => 'desc'])->select();
        $count = self::where($where)->count('id');
        return [
            'list'  => $list,
            'total' => $count,
            'pagenum' => $offset
        ];
    }

}
